import { oauthRequest } from '@/utils/HttpRequest';

export async function findByDevise(menuId: number) {
  //SwaggerResources
  let attrkey = 'findByDevisekey' + menuId;
  return new Promise<any>((resolve, reject) => {
    let items = localStorage.getItem(attrkey);
    if (items) {
      var parse = JSON.parse(items);

      resolve(parse);
    } else {
      oauthRequest
        .get<any>('devise/findByDevise', { menuId: menuId })
        .then((res) => {
          localStorage.setItem(attrkey, JSON.stringify(res));
          resolve(res);
        })
        .catch((e) => {
          reject(e);
        });
    }
  });
}
